package yxk.kd.hr.hspm.formplugin.web.schedule.draw.dialogform;

import kd.bos.algo.DataSet;
import kd.bos.algo.Row;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.form.ConfirmCallBackListener;
import kd.bos.form.FormShowParameter;
import kd.bos.form.MessageBoxOptions;
import kd.bos.form.container.Container;
import kd.bos.form.control.Button;
import kd.bos.form.control.Label;
import kd.bos.form.control.events.BeforeClickEvent;
import kd.bos.form.events.OnGetControlArgs;
import kd.bos.form.operate.MutexHelper;
import kd.bos.metadata.form.container.FlexPanelAp;
import kd.bos.metadata.form.control.LabelAp;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.hr.hbp.common.util.HRBaseUtils;
import kd.hr.hbp.common.util.HRStringUtils;
import kd.hr.hspm.formplugin.web.schedule.draw.cardview.EmpTrainFileCardPlugin;
import kd.sdk.hr.hspm.business.helper.FieldPermHelper;
import kd.sdk.hr.hspm.business.service.AttacheHandlerService;
import kd.sdk.hr.hspm.common.enums.PersonModelClassificationEnum;
import kd.sdk.hr.hspm.common.utils.CommonUtil;
import kd.sdk.hr.hspm.common.utils.ParamAnalysisUtil;
import kd.sdk.hr.hspm.common.utils.PersonModelUtil;
import kd.sdk.hr.hspm.formplugin.web.file.ermanfile.drawutil.ApCreateUtils;

import java.util.EventObject;
import java.util.List;
import java.util.Map;

/**
 * 培训经历扩展
 */
public class EmpTrainFileCardPluginEx extends EmpTrainFileCardPlugin {

    @Override
    public void click(EventObject evt) {
        if (evt.getSource() instanceof Label) {
            Label label = (Label)evt.getSource();
            String key = label.getKey();
            if(key.contains("dv_shamdel")||key.contains("_dv_shamedit")){
                String[] keys = key.split("_");
                QFilter qFilter = new QFilter("id", QCP.equals,Long.valueOf(keys[keys.length - 1]));
                DataSet empposorgrelRows = QueryServiceHelper.queryDataSet(this.getClass().getName(), "hrpi_emptrainfile", "description", qFilter.toArray(), null);
                for (Row row:empposorgrelRows){
                    if("来源：培训系统".equals(row.getString("description"))){
                        this.getView().showMessage("第三方来源培训经历不允许此操作");
                        return;
                    }
                }
            }
        }
        super.click(evt);
    }
}
